package org.example.spring.domain.pojo;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class    Result<T>{
    private Integer code;//状态码 0：成功 1：失败
    private String message;//消息
    private T data;//数据


    public static <E> Result<E> success(E data){
        return new Result<>(0,"成功",data);
    }
    public static Result success(){
        return new Result(0,"成功",null);
    }
    public static Result error(String message){
        return new Result(1,message,null);
    }
}
